package com.l2qq.common.task;

import com.jfinal.plugin.activerecord.Db;
import it.sauronsoftware.cron4j.Task;
import it.sauronsoftware.cron4j.TaskExecutionContext;

public class TokenCleanTask extends Task {
    @Override
    public void execute(TaskExecutionContext context) {
        long now = System.currentTimeMillis();
        // 清理过期会话
        Db.update("DELETE FROM sa_token_session WHERE expire_time < ?", now);
        // 清理过期Token
        Db.update("DELETE FROM sa_token_store WHERE expire_time < ?", now);
    }
}